<?php
/**
 * Created by PhpStorm.
 * User: Mr.Zhou
 * Date: 2018/11/12
 * Time: 2:09 PM
 */
defined('APP_DIR') || define('APP_DIR', dirname(__FILE__));

require_once APP_DIR . '/vendor/autoload.php';




try {

    //测试环境的grpc调用服务
    $client = new \Api\AppRankClient("10.42.16.23:9000", [
        'credentials' => \Grpc\ChannelCredentials::createInsecure()
    ]);

    $request = new \Api\AppRankRequest();
    $request->setAppid("597364850");
    $request->setKeyword("英语单词");
    $request->setSuffix("_jfq_backend");
    $request->setUseProxy(1);
    $request->setV(11);

    list($reply,$error) = $client->GetAppRank($request)->wait();
    if ($error->code) {
        exit("发送失败，错误信息：" . $error->details);
    }
    var_dump($reply->getRank());

} catch (\Exception $exception) {
    var_dump($exception->getMessage());
}
